<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-else</title>
</head>
<body>
    <div id="app">
        <input type="button" value="点我" @click="show=!show"/>
        <br>
        <br>
        <table style="width: 500px" v-if="show" border="1px" cellspacing="0px" cellpadding="5px">
            <tr v-for="(user,index) in users" :key="index" v-if="(index+1)%2==0" style="background-color: antiquewhite">
                <td v-text="index+1"></td>
                <td v-for="(v,k) in user" v-text="v"></td>
            </tr>
            <tr v-else style="background-color: aqua">
                <td v-text="index+1"></td>
                <td v-for="(v,k) in user" v-text="v"></td>
            </tr>
        </table>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>
        var vm=new Vue({
            el:"#app",
            data:{
                users:[
                    {name: '柳岩', gender: '女', age: 21},
                    {name: '有哥', gender: '男', age: 30},
                    {name: '范冰冰', gender: '女', age: 24},
                    {name: '刘亦菲', gender: '女', age: 18},
                    {name: '古力娜扎', gender: '女', age: 25}
                ],
                show:true
            }
        })
    </script>
</body>
</html>